'\"macro stdmacro
.\"
.\" Copyright (c) 2022 Ken McDonell.  All Rights Reserved.
.\"
.\" This program is free software; you can redistribute it and/or modify it
.\" under the terms of the GNU General Public License as published by the
.\" Free Software Foundation; either version 2 of the License, or (at your
.\" option) any later version.
.\"
.\" This program is distributed in the hope that it will be useful, but
.\" WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
.\" or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
.\" for more details.
.\"
.\"
.TH PMAGETLOG 3 "PCP" "Performance Co-Pilot"
.SH NAME
\f3pmaGetLog\f1 \- direct read of the next record from an archive file
.SH "C SYNOPSIS"
.ft 3
.ad l
.hy 0
#include <pcp/pmapi.h>
.br
#include <pcp/libpcp.h>
.br
#include <pcp/archive.h>
.sp
int pmaGetLog(__pmArchCtl *\fIacp\fP,
'in +\w'int pmaGetLog('u
int\ \fIvol\fP,
__int32_t\ **\fIrbuf\fP);
.in
.sp
cc ... \-lpcp_archive \-lpcp
.hy
.ad
.ft 1
.SH CAVEAT
This documentation is intended for internal Performance Co-Pilot
(PCP) developer use.
.PP
These interfaces are not part of the PCP APIs that are guaranteed to
remain fixed across releases, and they may not work, or may provide
different semantics at some point in the future.
.SH DESCRIPTION
.de CR
.ie t \f(CR\\$1\fR\\$2
.el \fI\\$1\fR\\$2
..
This is a cut-down version of
.BR __pmLogRead (3)
from libpcp, that reads the next physical record from the volume
.I vol
of the archive identified by
.IR acp .
.PP
If
.I vol
is
.B PM_LOG_VOL_META
then the next metadata record is read, otherwise the next record from
the data volume
.I vol
is read.
.PP
The record is returned in
.I rbuf
which is allocated here; so the caller will have to call
.BR free (3)
when it is no longer needed.
.PP
The record header length and trailer length is checked, but otherwise
.I rbuf
is not processed, and in particular the record remains in network byte-order.
.SH DIAGNOSTICS AND RETURN VALUES
The return value is 0 if all is well, else PM_ERR_EOL for end of file,
else some other error code less than zero.
.SH SEE ALSO
.BR free (3),
.BR pmaPutLog (3),
.BR PMAPI (3)
and
.BR __pmLogRead (3).
